﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Models;
using BI.ViewModels;

namespace THMClient
{
    public partial class Shell : Form
    {
        private ShellViewModel shellViewModel = null;

        public Shell()
        {
            InitializeComponent();
            shellViewModel = new ShellViewModel();
        }

        private void _get_windows_button_Click(object sender, EventArgs e)
        {
            List<PokerWindow> pokerWindows = shellViewModel.PokerWindows;
            _windows_listbox.Items.Clear();
            foreach (PokerWindow pokerWindow in pokerWindows)
            {
                _windows_listbox.Items.Add(pokerWindow.Title);
            }
        }

        private void _Open_Table_Click(object sender, EventArgs e)
        {
            if (_windows_listbox.SelectedIndex != -1)
            {
                PokerWindow selectedPokerWindow = shellViewModel.PokerWindows.FirstOrDefault(x => x.Title == _windows_listbox.SelectedItem.ToString());

                THM_Table THM_Table = new THM_Table(new THM_TableViewModel(selectedPokerWindow));

                THM_Table.Show();
            }
        }
    }
}
